/*

* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
* |     Smart-Shop开源商城系统/ Java商城-首选电商平台系统 请务必保留此注释头信息
* |     开源地址: https://gitee.com/ningbo-qishan/gruul-mall
* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
* |     可正常分享和学习源码,未经授权 不可商用！
* |     商业版中台购买/开源版商业授权 联系技术客服
* |     官网:  https://www.73app.cn/
* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
* |     Copyright (c) 2016-2999 宁波启山智软科技有限公司
* |     版权所有 ,侵权必究！
* ------------------------------------------------------------------------

*/
package com.medusa.gruul.integral.web.controller.manager;

import com.medusa.gruul.common.core.util.PageUtils;
import com.medusa.gruul.common.core.util.Result;
import com.medusa.gruul.integral.service.IIntegralCouponOrderService;
import com.medusa.gruul.integral.web.model.dto.manager.IntegralCouponOrderDto;
import com.medusa.gruul.integral.web.model.param.manager.IntegralCouponOrderParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;

/**
 * @Description: 积分优惠券订单
 * @Author: xiaoq
 * @Date : 2020/1/9 10:25
 */

@RestController
@RequestMapping("/manager/integralCouponOrder")
@Api(tags = "积分优惠券订单相关接口")
public class IntegralCouponOrderController {

    @Autowired
    private IIntegralCouponOrderService integralCouponOrderService;


    /**
     * pc端 积分优惠券订单分页展示
     *
     * @param integralCouponOrderParam 查询条件
     * @return 符合条件的 优惠券订单
     */
    @ApiOperation(value = "积分优惠券订单")
    @GetMapping("get/integralCouponOrder")
    public Result<PageUtils<IntegralCouponOrderDto>> searchIntegralCouponOrder(IntegralCouponOrderParam integralCouponOrderParam) {
        PageUtils<IntegralCouponOrderDto> page = new PageUtils(integralCouponOrderService.searchOrders(integralCouponOrderParam));
        return Result.ok(page);
    }


    /**
     * 批量备注 积分优惠券订单
     *
     * @param ids        积分优惠券订单ids
     * @param backRemark 备注内容
     * @param isCoverage 是否覆盖
     */
    @ApiOperation(value = "订单批量备注功能")
    @PutMapping("update/orderRemark")
    public Result updateRemark(@RequestBody Long[] ids, @RequestParam(value = "backRemark") String backRemark,
                               @RequestParam(value = "isCoverage") Boolean isCoverage) {
        integralCouponOrderService.remarkIntegralCouponOrder(Arrays.asList(ids), backRemark, isCoverage);
        return Result.ok();
    }
}
